package com.mobilepay.moneypig.model.dialog;

import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.mobilepay.moneypig.R;
import com.mobilepay.moneypig.base.BaseDialog;

/**
 * Created by xlm on 2017/7/28 0028
 */

public class ConfirmDialog extends BaseDialog {
    public ConfirmDialog(Context context) {
        super(context);
    }

    public ConfirmDialog(Context context, int themeResId) {
        super(context, themeResId);
    }

    protected ConfirmDialog(Context context, boolean cancelable, OnCancelListener cancelListener) {
        super(context, cancelable, cancelListener);
    }

    @Override
    protected void onSetContentView() {
        setContentView(R.layout.dialog_confirm);
    }

    private String mContent;
    private TextView mTextContent;
    private TextView mTextConfirm;

    @Override
    protected void initViews() {
        mTextContent = (TextView) findViewById(R.id.confirm_content);
        mTextConfirm = (TextView) findViewById(R.id.comfirm_confirm);
        initWindow(0.7f, 0);
        setAnimate(R.style.animatedialog2);
    }

    @Override
    protected void onSetListener() {
        mTextConfirm.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                listener.onConfirm();
            }
        });
    }

    @Override
    protected void afterOnCreate(Bundle savedInstanceState) {
        if (mContent != null) {
            mTextContent.setText(mContent);
        }
    }

    public void setContent(String str) {
        mContent = str;
        if (mTextContent != null) {
            mTextContent.setText(mContent);
        }
    }

    private Listener listener;

    public void setListener(Listener listener) {
        this.listener = listener;
    }

    public static class Listener {
        public void onConfirm() {

        }
    }
}
